package com.it.emall.controller;


import com.it.emall.domain.BannerAd;
import com.it.emall.domain.Ingredients;
import com.it.emall.service.BannerService;
import com.it.emall.service.ChannelService;
import com.it.emall.utils.ResponseUtils;
import org.apache.tomcat.util.http.ResponseUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 首页Controller
 */
@RestController
public class HomeController {


    @Autowired
    private ChannelService channelService;
    @Autowired
    private BannerService bannerService;

//首页仪表盘
    @GetMapping("/wx/home/index")
    public Object index(){
        List<Ingredients> list = channelService.selectChannelList();
        List<BannerAd> bannerAds = bannerService.selectBnnerList();

        Map<String ,Object> data=new HashMap<>();
        data.put("channel",list);
        data.put("banner",bannerAds);
        return ResponseUtils.ok(data);

    }
}
